<template>
  <div
    class="task-item"
    :class="{
      'task-item--active': taskId == task.id,
    }"
  >
    <div class="task-info">
      <!-- <span class="task-info__label">任务类型：</span>
      <span class="task-info__value">{{ task._taskTypeDesc }}</span> -->
      <span class="task-info__label">自动出货：</span>
      <span class="task-info__value">{{ task.task_name }}</span>
    </div>
    <div class="task-order">
      <div class="game-info">
        <div class="game-name">{{ task.minfo?.league_name }}</div>
        <div class="game-player">
          <div class="game-player-item">{{ task.minfo?.home_name }}</div>
          <div class="vs"></div>
          <div class="game-player-item">{{ task.minfo?.away_name }}</div>
        </div>
      </div>
      <div class="task-order__right">
        <app-info class="taskrightinfo">
          <app-info-item label="订单数：" :value="task.order_total_count" />
          <app-info-item label="总金额：" :value="task.total_stake" />
          <app-info-item label="已完成：">
            <app-text>{{ task.order_success_count }}</app-text>
            <app-text type="primary"> ({{ task._successRate }}%) </app-text>
          </app-info-item>
          <app-info-item label="已完成：">
            <app-text>{{ task.success_stake }}</app-text>
            <app-text type="primary"> ({{ task._completeRate }}%) </app-text>
          </app-info-item>
        </app-info>
      </div>
    </div>
    <div class="task-time">{{ task.minfo?.match_time }}</div>
    <Game v-model="gameId" :task="task" :games="task.gun_data" />
  </div>
</template>
<script setup>
import Game from './Game.vue'

const taskId = defineModel({ type: Number })

const gameId = ref(null)
const prosp = defineProps({
  task: Object,
})
</script>
<style lang="scss" scoped>
.task-item {
  border-bottom: 8px solid #f5f5f5;
  padding: 16px 0;
  &:last-child {
    border-bottom: none;
  }
}

.task-item--active {
  background-color: #fff;
}

.task-info {
  display: flex;
  margin-bottom: 8px;
}

.task-info__label {
  color: #778090;
}

.task-info__value {
  font-weight: bold;
  color: #778090;
  margin-right: 24px;
}

.game-info {
  flex: 1;
}

.game-name {
  color: #252a30;
  margin-bottom: 4px;
}

.game-player {
  display: flex;
  align-items: center;
  font-size: 16px;
  font-weight: 600;
  .vs {
    width: 16px;
    height: 16px;
    margin: 0 8px;
    background: url('@/assets/home/vs.png');
    background-size: 100% auto;
  }
}

.task-order {
  display: flex;
  align-items: center;
  margin-bottom: 4px;
}

.task-order__right {
  // width: 55%;
  min-width: 50%;
  max-width: 60%;
  text-align: right;

  :deep(.app-info-item__value) {
    font-size: 16px;
    font-weight: bold;
    display: flex;
    align-items: center;
  }
}

.task-time {
  margin-bottom: 8px;
  color: #778090;
  background: url('@/assets/home/time.png') no-repeat 0 center;
  padding-left: 20px;
}

::v-deep .taskrightinfo.app-info{
  justify-items: start;
  grid-template-columns: repeat(2 , auto);
}
</style>
